package com.njwb.day09.ens;

public class TestDemo01 {


    public static void main(String[] args) {
//        Scanner scanner = new Scanner(System.in);
//        System.out.println("请输入你英雄类型");
//        String heroType  = scanner.next() ;
//
//
//        //将一个字符串转换成对应的枚举类
//        HeroOfKingType heroOfKingType = Enum.valueOf(HeroOfKingType.class,heroType);
//        System.out.println(heroOfKingType);


        HeroOfKingType[] heroOfKingTypes = new HeroOfKingType[] {HeroOfKingType.MAGE,HeroOfKingType.SHOOTER,HeroOfKingType.WARRIOR,HeroOfKingType.GANKING};


        for (HeroOfKingType hkt :heroOfKingTypes) {
            //ordinal():枚举对象在枚举类型定义的次序
            //name()：返回枚举对象的名字
            System.out.println(hkt.name()+"-->"+hkt.ordinal());
            hkt.target();
        }


    }
}
